/**
 * 
 */
package org.myontology.controller.impl;

import org.myontology.controller.AbstractAction;
import org.myontology.controller.Action;
import org.myontology.controller.AttributeHolder;
import org.myontology.controller.AttributeLevel;
import org.myontology.controller.ValueHandler;

import controller.javaBeans.SearchBean;

/**
 *  @author <a href="michael.hackl@sti2.at">Michael Hackl</a>
 * Project: Myontology - www.myontology.org
 * STI
 */
public class SearchAction extends AbstractAction implements Action {

	public static final ValueHandler<SearchBean> SEARCH = new ValueHandler<SearchBean>(AttributeLevel.SESSION,SearchAction.class);
	
	/* (non-Javadoc)
	 * @see org.myontology.controller.Action#execute(org.myontology.controller.AttributeHolder)
	 * 
	 * 
	 * 
	 */
	public void execute(AttributeHolder attributes) throws Exception {
		SearchBean bean = SEARCH.getValue(attributes);
		if (bean==null) {
			bean = new SearchBean();
			SEARCH.setValue(attributes, bean);
		}
		if (attributes.getRequestParameter("searchItem")!=null) {
			bean.setSearchItem(attributes.getRequestParameter("searchItem"));
			bean.setSearchType(attributes.getRequestParameter("searchType"));
			bean.setSearchField(attributes.getRequestParameter("searchField"));
			bean.setSearchOption(attributes.getRequestParameter("searchOption"));
		}
	}

}
